
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>我的订单</title>
    <base href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/pages/MyOrders.jsp"/>
    <script type="text/javascript" src="../Jquery/jquery-1.8.3.js"></script>
    <script type="text/javascript">
        $(function () {
            $(".receive").click(function () {
                var id=$(this).parent().parent().find(":first").text();
                if(confirm("您确定要签收该订单吗?")){
                    location.href="../order?action=receiveOrder&id="+id;
                }
            });
        });
    </script>
</head>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<body>
<table align="center" border="1" cellspacing="0">
    <tr>
        <th>订单号</th>
        <th>交易价格</th>
        <th>创建时间</th>
        <th>当前状态</th>
        <th>详情</th>
    </tr>
    <c:forEach items="${orders}" var="order">
        <tr>
            <td>${order.id}</td>
            <td>${order.price}</td>
            <td>${order.createTime}</td>
            <c:choose>
                <c:when test="${order.status==0}">
            <td>未发货</td>
            </c:when>
            <c:when test="${order.status==1}">
                <td>已发货<button class="receive">签收</button></td>
            </c:when>
            <c:when test="${order.status==2}">
                <td>已签收</td>
            </c:when>
            </c:choose>
            <td><a href="../order?action=showMyOrderDetails&id=${order.id}">订单详情</a></td>
        </tr>
    </c:forEach>
</table>

</body>
</html>
